<?php
	if ($_FILES['img']['error']>0) {
		exit("上传错误");
	}else{
		$path = "../uploads/".$_FILES['img']['name'];
		 move_uploaded_file($_FILES['img']['tmp_name'],$path);    //图片上传
		 $img = "../uploads/".$_FILES['img']['name'];
	}
	include('../function.php');
	$conn = conn();
	$cata_id = $_POST['cata_id'];
	$title = $_POST['title'];
	$desc = $_POST['desc'];
	$content = addslashes($_POST['content']);
	$time = time();
	$id = $_POST['id'];
	$sql = "update article set `catalog_id`='$cata_id',`title`='$title', `desc`='$desc', `content`='$content', `create_time`='$time', `img`='$img' where id='$id'";
	//write是关键字;
	mysqli_query($conn,$sql);
	header("Location:list.php?cata_id=$cata_id");
	
?>